package com.sqx.modules.toppingConfig.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.toppingConfig.entity.ToppingConfig;
import com.sqx.modules.toppingConfig.service.IToppingConfigService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 置顶时长配置 前端控制器
 * </p>
 *
 * @author wuchang
 * @since 2023-07-27
 */
@RestController
@RequestMapping("/app/toppingConfig/")
public class ToppingConfigController {
    @Autowired
    private IToppingConfigService configService;


    @ApiOperation("获取时长配置列表")
    @GetMapping("getConfigList")
    public Result getConfigList(Integer page, Integer limit, ToppingConfig config) {
        config.setIsEnable(1);
        return Result.success().put("data", configService.getConfigList(page, limit, config));
    }
    @Login
    @ApiOperation("购买置顶")
    @PostMapping("buyTopping")
    public Result buyTopping(@RequestAttribute("userId")Long userId,Long postPushId,Long configId){
        return configService.buyTopping(userId,postPushId,configId);
    }
}
